package entity;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 购物车
 * @version 1.0
 * @Author: xxf
 * @CreateDate: 2020/9/27 16:41
 */
public class Cart implements Serializable {
    private static final long serialVersionUID = 7028108244280423891L;

    private Integer cid;
    private Integer uid;
    private Integer pid;
    private Integer cnum = 0;// 购物车商品数量
    private BigDecimal ccount;// 购物车小计
    private Product product;//关联商品实体

    @Override
    public String toString() {
        return "Cart{" +
                "cid=" + cid +
                ", uid=" + uid +
                ", pid=" + pid +
                ", cnum=" + cnum +
                ", count=" + ccount +
                ", product=" + product +
                '}';
    }

    public Cart(Integer uid) {
        this.uid = uid;
    }

    public Cart() {
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public Integer getCid() {
        return cid;
    }

    public void setCid(Integer cid) {
        this.cid = cid;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public Integer getCnum() {
        return cnum;
    }

    public void setCnum(Integer cnum) {
        this.cnum = cnum;
    }

    public BigDecimal getCcount() {

        return new BigDecimal((product.getPprice()* cnum));
    }

    /*public void setCcount(BigDecimal ccount) {
        this.ccount = ccount;
    }*/
}
